//
// Created by Administrator on 2025/2/23.
//

#include "rtthread.h"
#include "main.h"
#include "stdio.h"
#include "app_rtt.h"
#include "rthw.h"
struct rt_thread led_thread;
rt_uint8_t rt_led_thread_stack[128];
void led_task_entry(void *parameter);
extern UART_HandleTypeDef huart1;
//初始化线程函数
void MX_RT_Thread_Init(void)
{
  //初始化LED线程
  rt_thread_init(&led_thread,"led",led_task_entry,RT_NULL,
                 &rt_led_thread_stack[0],sizeof(rt_led_thread_stack),15,20);
  //开启线程调度
  rt_thread_startup(&led_thread);
}

//主任务
void MX_RT_Thread_Process(void)
{
//    printf("Hello RT_Thread!!!");

  rt_thread_delay(2000);

}

//LED任务
void led_task_entry(void *parameter)
{
  while(1)
  {
    HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_1);
    rt_thread_mdelay(500);
    HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_2);
    rt_thread_mdelay(500);
//    rt_kprintf("hello RT-Thread!\n");
  }
}